package com.oumizz.doublelistview.adapter;

import android.content.Context;
import android.graphics.Paint;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.oumizz.doublelistview.R;


/**
 * ┏┓　　　┏┓
 * ┏┛┻━━━┛┻┓
 * ┃　　　　　　　┃
 * ┃　　　━　　　┃
 * ┃　┳┛　┗┳　┃
 * ┃　　　　　　　┃
 * ┃　　　┻　　　┃
 * ┃　　　　　　　┃
 * ┗━┓　　　┏━┛
 * ┃　　　┃   神兽保佑
 * ┃　　　┃   代码无BUG！
 * ┃　　　┗━━━┓
 * ┃　　　　　　　┣┓
 * ┃　　　　　　　┏┛
 * ┗┓┓┏━┳┓┏┛
 * ┃┫┫　┃┫┫
 * ┗┻┛　┗┻┛
 * create by 2017/2/24 16:55
 * annotation:
 */
public class RightListViewAdapter extends BaseAdapter {

    Context context;
    private String [] str;
    public RightListViewAdapter(Context context) {
        this.context = context;

    }
    public RightListViewAdapter(Context context, String[] str) {
        this.context = context;
        this.str=str;
    }

    @Override
    public int getCount() {
        return str.length;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {

        ViewHodler hodler = null;
        if (view==null){
            hodler = new ViewHodler();
            view = View.inflate(context, R.layout.rightlist_item,null);

            hodler.imageItem = (ImageView) view.findViewById(R.id.imageItem);
            hodler.textItem = (TextView) view.findViewById(R.id.textItem);
            hodler.on_price = (TextView) view.findViewById(R.id.on_price);
            hodler.out_time_fh = (TextView) view.findViewById(R.id.out_time_fh);
            hodler.out_time_num = (TextView) view.findViewById(R.id.out_time_num);

            view.setTag(hodler);
        }else {
           hodler = (ViewHodler) view.getTag();
        }

        hodler.textItem.setText(str[i]);
        hodler.out_time_fh.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        hodler.out_time_num.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        return view;
    }

    private class ViewHodler{
        ImageView imageItem;
        TextView textItem;
        TextView on_price;
        TextView out_time_fh;
        TextView out_time_num;

    }
}
